<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Animal(name,age,gender){
            this.name = name;
            this.age = age;
            this.gender = gender;
            console.log(this);
        }
        Animal.prototype.eat = function(){
            console.log("吃");
        }

        function Dog(name,age,gender){
            //构造继承,也叫call继承,只能继承属性
            // console.log(this);
            Animal.call(this,name,age,gender);
        }
        // //创建一个狗的对象
        let d = new Dog("阿黄",18,"男")
        console.log(d);





        // function fn(name,age,gender){
        //     this.name = name;
        //     this.age = age;
        //     this.gender = gender;
        //     console.log(this);
        // }

        // fn("文渊",18,"男");

    </script>
</body>
</html>